﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace hse_2013_272_lines
{
    public class Block
    {
        Image blockImage;

        public void Draw(Graphics g, int x, int y)
        {
            if (blockImage != null)
            {
                //var temp = new Bitmap(blockImage);
                //var temp2 = temp.Clone(new Rectangle(0, 0, 20, 20), System.Drawing.Imaging.PixelFormat.Format16bppGrayScale);
                //g.DrawImageUnscaledAndClipped(blockImage, new Rectangle(0, 0, 20, 20));
                g.DrawImage(blockImage, x, y
                    //new Rectangle(1, 1, 20, 20)
                    );
            }
            /*
            else
            {
                g.DrawImage(Properties.Resources.Оранжевый_квадрат, x, y);
            }
             * */
        }

        Block(Image blockImage)
        {
            this.blockImage = blockImage;
        }

        static Block()
        {
            // 
            Red = new Block(Properties.Resources.Красный_квадрат);
            Orange = new Block(Properties.Resources.Оранжевый_квадрат);
            Yellow = new Block(Properties.Resources.Желтый_квадрат);
            Green = new Block(Properties.Resources.Зеленый_квадрат);
            Cyan = new Block(Properties.Resources.Голубой_квадрат);
            Blue = new Block(Properties.Resources.Синий_квадрат);
            Magenta = new Block(Properties.Resources.Сиреневый_квадрат);

            // А вот тут всё правильно.
            Empty = new Block(null);
        }

        public static Block Red { get; private set; }
        public static Block Orange { get; private set; }
        public static Block Yellow { get; private set; }
        public static Block Green { get; private set; }
        public static Block Cyan { get; private set; }
        public static Block Blue { get; private set; }
        public static Block Magenta { get; private set; }
        public static Block Empty { get; private set; }
    }
}
